import type { postOrPutType } from "@/constants";
import type { HasId, IList, IResult } from "@/types/common";
import { getAxios, commonAxiosJson, deleteAxios } from "@/utils/request.js";
/* 严选专场 地址 */
const url = "/back/mall-special";
/* 严选专场数据：获取 严选专场活动信息 */
export const getMallSpecialInfo = <T, D>(params?: D): Promise<IResult<IList<T>>> => {
  return getAxios<IList<T>, D>(url, params);
};
/* 严选专场数据：获取 严选专场活动详情信息 */
export const getMallSpecialByIdInfo = <T, D extends HasId>(params: D): Promise<IResult<T>> => {
  return getAxios<T, D>(url + "/" + params.id, params);
};
/* 严选专场数据：新增，修改严选专场活动信息 */
export const commonMallSpecialInfo = <T, D>(params: D, type: postOrPutType): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url, params, type);
};
/* 严选专场数据：删除 严选专场活动信息 */
export const deleteMallSpecialInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return deleteAxios<T, D>(url, params);
};
